unit U_fm_pesq_item;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Grids, Vcl.DBGrids, Vcl.StdCtrls,
  Vcl.Buttons, Vcl.ExtCtrls, Data.DB;

type
  Tfm_pesq_item = class(TForm)
    Panel1: TPanel;
    Panel2: TPanel;
    lbl_item: TLabel;
    rdg_opcao: TRadioGroup;
    edt_descricao: TEdit;
    btn_loc: TBitBtn;
    Panel3: TPanel;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    Panel4: TPanel;
    DBGrid1: TDBGrid;
    DataSource3: TDataSource;
    RadioGroup1: TRadioGroup;
    procedure FormShow(Sender: TObject);
    procedure btn_locClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fm_pesq_item: Tfm_pesq_item;

implementation

{$R *.dfm}

uses U_dm_principal, U_fm_add_item;

procedure Tfm_pesq_item.btn_locClick(Sender: TObject);
begin
      dm_principal.cds_produto.Close;
      dm_principal.sq_produto.SQL.Text:= 'select p.codigo_item,'
                                            +#13+' p.descricao,'
                                            +#13+' p.fornecedor,'
                                            +#13+' p.subgrupo, '
                                            +#13+' p.fabricante,'
                                            +#13+' p.unidade, '
                                            +#13+' p.comissao1,'
                                            +#13+' p.comissao2,'
                                            +#13+' p.comissao3,'
                                            +#13+' p.icms,'
                                            +#13+' p.ipi,  '
                                            +#13+' p.substituicao_ent,'
                                            +#13+' p.frete,'
                                            +#13+' p.referencia,'
                                            +#13+' p.cod_barra,'
                                            +#13+' p.peso_liq,'
                                            +#13+' p.peso_bruto,'
                                            +#13+' p.data,'
                                            +#13+' p.hora, '
                                            +#13+' p.icms_saida,'
                                            +#13+' p.ipi_saida,'
                                            +#13+' p.substituicao_saida,'
                                            +#13+' p.grupo,'
                                            +#13+' p.estoque_minimo,'
                                            +#13+' p.pis,'
                                            +#13+' p.cofins,'
                                            +#13+' p.ir,'
                                            +#13+' p.comissoes,'
                                            +#13+' p.despesas_operacionais,'
                                            +#13+' p.marge_lucro,'
                                            +#13+' p.cst,'
                                            +#13+' p.origem,'
                                            +#13+' p.ii,'
                                            +#13+' p.cst_ipi,'
                                            +#13+' p.cst_pis,'
                                            +#13+' p.cst_cofins,'
                                            +#13+' p.pis_st,'
                                            +#13+' p.issqn,'
                                            +#13+' p.pmvast,'
                                            +#13+' p.modbc_st,'
                                            +#13+' p.cst_ent,'
                                            +#13+' p.pmvast_ent,'
                                            +#13+' p.status,'
                                            +#13+' p.obs,'
                                            +#13+' p.img,'
                                            +#13+' p.tipo_item,'
                                            +#13+' p.producao,'
                                            +#13+' p.vipi_ent,'
                                            +#13+' p.vipi_sai,'
                                            +#13+' p.iss,'
                                            +#13+' p.csosn_ent,'
                                            +#13+' p.csosn_sai,'
                                            +#13+' p.modbc,'
                                            +#13+' p.genero,'
                                            +#13+' p.preco1,'
                                            +#13+' p.reducao_e_icms,'
                                            +#13+' p.reducao_s_icms,'
                                            +#13+' p.reducao_e,'
                                            +#13+' p.reducao_s,'
                                            +#13+' p.md_icms,'
                                            +#13+' P.md_icms_st,'
                                            +#13+' p.cst_ipi_ent,'
                                            +#13+' p.preco3,'
                                            +#13+' p.preco2,'
                                            +#13+' p.ncm '
                                            +#13+'from produto p'
                                            +#13+' where p.descricao <> ' + QuotedStr('');
         if  length(trim(edt_descricao.Text))>0 then
             dm_principal.sq_produto.SQL.Add(' and p.descricao containing '+QuotedStr(edt_descricao.Text));
             dm_principal.cds_produto.Open;

end;

procedure Tfm_pesq_item.FormShow(Sender: TObject);
begin
dm_principal.cds_item.Open;
dm_principal.cds_produto.Open;
dm_principal.cds_item.Edit;
end;

end.
